home *** CD-ROM | disk | FTP | other *** search
/ Freaks Macintosh Archive / Freaks Macintosh Archive.bin / Freaks Macintosh Archives / Textfiles / zines / hir / hir5 Folder.sit / hir5 Folder / HIR5-4.TXT < prev    next >
Text File  |  1998-04-23  |  8KB  |  182 lines

  1.  
  2.             |-|  |  R   5
  3.                    FUN WITH UNIX PART DEUX
  4.  
  5.         Asmodians Guide to Securing LINUX
  6.         By /|smodian ><ius 
  7.  
  8. **********************************************************
  9.     1.    Introduction
  10.     2.    Installation Stuff
  11.     3.    Permissions after u install
  12.     4.    Just Say no to root, using the right users
  13.     5.    Installing software the right way
  14.     6.    Disk Usage control with Quotas
  15. **********************************************************
  16.  
  17. <* Part 1 *>
  18. Introduction
  19.  
  20.     Linux is one of the most versatile UNIX type operating systems
  21. available.  It's also free, making it the choice of poor micro-sloth hating
  22. hackers everywhere.  So what's the big deal about securing Linux? Why do I
  23. need to worry about some dick reading my mail?  Is this really necessary? 
  24.     The answer to all those questions will be covered within this text. 
  25.  
  26. *NOTE: This article already assumes you have user knowledge with
  27. UNIX/Linux. If not I suggest you either read some manuals or like read
  28. the users guide to LINUX.  You can get that from "http://sunsite.unc.edu/LDP" 
  29.     
  30. Or if you got 15$ to spare, get the dummies guide to UNIX. 
  31.  
  32.  
  33. <* Part 2* > 
  34. Installation
  35.  
  36.     Setting up Linux is the trickiest thing you will ever run into.  I
  37. will not cover how to install Linux, but I will cover what distributions
  38. you should consider. There are 3 major distributions that you will
  39. encounter, although there are a lot of others. The three major
  40. distributions you will see are, DEBIAN,REDHAT, and SLACKWARE.  Of the
  41. three , DEBIAN is usually the most stable and SLACKWARE is close after
  42. Debian, with REDHAT hauling in dead last. 
  43.  
  44.     I personally use Slackware v3.4, which contains a bug fix for one
  45. of the binaries.  For all intents an purposes, all examples will use the
  46. Second Extended File system or otherwise known as the EXT2 File system. I
  47. suggest you not use REDHAT because its installation process is some what
  48. messed up.  REDHAT does not support the UMSDOS filesystem for an install
  49. which detracts from its usefulness in other applications.  Keep in mind
  50. the UMSDOS install is TOO slow for running a full LINUX system, however it
  51. is good for a quick and dirty Linux installation. 
  52.  
  53.  
  54. Here is a small list of things to get and install for your Linux computer:
  55.  
  56. o    Quota Support, and utilities <install from distribution>
  57. o    Network support <from Distribution>
  58. o    BSD TCPDUMP program, <http://www.sunsite.unc> great for 
  59.     WINNUKE detection scripts *see below for script
  60. o    programming stuff like GNU C & C++ .. perl.. etc
  61.     <from distribution>
  62. o    agetty <from distribution>
  63. o    Kernel Package <from distribution>
  64. o    Sudo, <prog to allow certain users root access to certain programs>
  65.  
  66. Heres some items that make life easier:
  67.  
  68. o    The mail reader PINE, which comes with the popular editor PICO. 
  69. o    X Windows <from Distribution>
  70.  
  71.  
  72. < * Part 3 * > 
  73. Permissions after u install
  74.  
  75. (stuff to run first)
  76.     After you install make sure to log in as root, and change roots
  77. password.  After that make sure you run sudo, and su.  You need to do that
  78. because it will set up the correct permissions on the log files.  NEVER
  79. LET A USER RUN THOSE PROGRAMS FIRST, ROOT MUST DO IT!  A user can clobber
  80. <erase> the su and sudo logs if they run the program first. This is
  81. because when it makes the log file it will still be owned root, but if the
  82. user has his umask set to 0, the logs will be mode 666 (world writability
  83. in logs is NOT K-Rad). 
  84.  
  85. (Device Permissions) 
  86.     If you install sound support into the Kernel, any user can record
  87. sounds from the microphone.  Which is kind of a bummer because its not
  88. just a data security breech, its a physical breech too. 
  89.  
  90. (control access to devices and data with groups)
  91.     You can control access to sound or a certain drive or partition by
  92. altering the group permissions to make only a certain group that can
  93. access the desired resource. 
  94.  
  95. (lock up your Dos and windows files)
  96.     If you want to access your old DOS and windows files and or drives
  97. mount the drives if any using the UMSDOS file system.  It is slow, and it
  98. only supports 8 character but you can control permissions much better. 
  99.  
  100. (XWINDOWS PERMISSIONS PROBLEM)  
  101.     Xwindows will happily cough out roots encrypted password if told
  102. to fetch the password list via the "alternate init script switch" feature
  103. on startx. change it so only root or some other protected account can
  104. access the startx, xinit and possibly the xdm programs..
  105.  
  106. <* part 4 * > 
  107. Just Say no to ROOT, Using the right users
  108.  
  109.     Your first impulse will be to use the all powerful root account to
  110. do everything.  Well don't... Root is the first thing people go after to
  111. compromise your security.  We want to cut root off for people who fish for
  112. passwords, weather by telnet or a dial- up that you may have.  There's a
  113. file called "/etc/login.access", inside there are some brief instructions
  114. on how to restrict certain users and groups from logging in remotely. 
  115. This will stop most hacks.  Although users can still get ROOT like powers
  116. from buggy utilities and such.  But I wont go into detail about what you
  117. should fix.  Instead I suggest you get on the bugtraq mailing list.
  118. Another good mailing list to be on is the one at <www.rootshell.com>. 
  119. They will email you security bulletins as soon a s they are reported, as
  120. well as fixes. 
  121.     
  122. <* part 5 *>
  123. INSTALLING SOFTWARE THE RIGHT WAY
  124.  
  125.     When you are root, one of the main reasons to be root is to
  126. install new software, BE CAREFUL, only get software from trusted sources,
  127. such as the dealers own web page.  NEVER EVER INSTALL SOFTWARE GIVEN TO
  128. YOU FROM A USER, find out where to get it or make sure it has source
  129. code, and go over it well!! 
  130.  
  131. (all TARed up) 
  132.     When using tar, be sure to check the permissions on the files as
  133. well as ownership. change it to be owned by a secure account after you've
  134. verified the content of the package.  Tar will some times allow for files
  135. installed to be owned by another UID <user ID number> than your own, that
  136. originated on another system.  This will cause havoc because suddenly some
  137. random user has rights to that new widget you just compiled, not to
  138. mention the persons quotas will be wrecked.  <SEE QUOTAS BELOW>
  139.  
  140. <* PART 6 *>
  141. Control disk usage with quotas
  142.  
  143.     Quotas so far only works with the ext2 file system < which is the
  144. most advanced file system available for use with Linux.> A person will
  145. also want to consult the MINI-HOWTO regarding installation of quotas. 
  146. Installation requires a kernel with quotas support and support for the
  147. ext2 file system.  All you need to do is read the mini HOWTO <the howtos
  148. are included in most distributions of Linux <at least Slackware does.>
  149.     From there on you just need to run "edquota" when ever you want to
  150. alter a users file usage limits.  You can control multiple file systems
  151. just by attaching all the file systems to the root directory, or
  152. individually, a device at a time, each with its own quota settings. 
  153. again, be sure to control access to the quota files and utilities. 
  154.     One note, some versions of quota, will ignore UID's <user id
  155. numbers> and in some cases, login names above 65535.  Just the writer 
  156. forgot to make a variable big enough.  So users with a high UID or a
  157. login name of "65536" or higher can avoid quota control. When making new 
  158. users, keep that fact in mind. 
  159.  
  160. <EOF AGSL>
  161.  
  162. <ADDENDUM 1>
  163.  
  164. #!/bin/bash
  165.  
  166. #NUKE DETECTION SCRIPT
  167. #****************!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  168. #This script works best for a stand alone Linux system
  169. #that IS NOT connected to a WINDOWS 9x computer TCP/ip network .
  170. #you will get a huge log of WIN 95 trafuck.  But a PPP connection should 
  171. #not have any win crap.  Thus what ever win shit you get 
  172. #should be a WINNUKE.. complete with return address :>
  173. #
  174. #RETURN TO SENDER BITCH!
  175. #***********************************************************
  176.  
  177. #either pipe the output to a terminal, or a file or use "cut" or "awk" and 
  178. #just have it crank out the senders IP address 
  179.  
  180. TCPDUMP |grep "wins">> /var/logs/nuke.log
  181. #<EOF>
  182.